Socket
Socket
Sign inDemoInstall

rusha

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rusha

A high-performance pure-javascript SHA1 implementation suitable for large binary data.


Version published
Weekly downloads
357K
increased by3.7%
Maintainers
1
Weekly downloads
 
Created

What is rusha?

Rusha is a high-performance, pure JavaScript implementation of the SHA-1 hashing algorithm. It is designed to be fast and efficient, making it suitable for use in web applications where performance is critical.

What are rusha's main functionalities?

Hashing a string

This feature allows you to hash a string using the SHA-1 algorithm. The code sample demonstrates how to create a new instance of Rusha and use it to hash the string 'Hello, world!'.

const Rusha = require('rusha');
const rusha = new Rusha();
const hash = rusha.digest('Hello, world!');
console.log(hash);

Hashing an ArrayBuffer

This feature allows you to hash an ArrayBuffer using the SHA-1 algorithm. The code sample demonstrates how to create an ArrayBuffer, populate it with data, and then hash it using Rusha.

const Rusha = require('rusha');
const rusha = new Rusha();
const buffer = new ArrayBuffer(8);
const view = new Uint8Array(buffer);
view[0] = 72; // ASCII code for 'H'
view[1] = 101; // ASCII code for 'e'
view[2] = 108; // ASCII code for 'l'
view[3] = 108; // ASCII code for 'l'
view[4] = 111; // ASCII code for 'o'
const hash = rusha.digest(buffer);
console.log(hash);

Incremental hashing

This feature allows you to perform incremental hashing, which is useful for hashing large amounts of data in chunks. The code sample demonstrates how to reset the state, append data in chunks, and then finalize the hash.

const Rusha = require('rusha');
const rusha = new Rusha();
rusha.resetState();
rusha.append('Hello, ');
rusha.append('world!');
const hash = rusha.end();
console.log(hash);

Other packages similar to rusha

Keywords

FAQs

Package last updated on 08 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc